﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CSharp_Tetris
{

    public partial class HighScores : Form
    {
        long[] scoreList;
        string _user;
        long _score;
        public HighScores(long[] scores, string user, long score)
        {
            scoreList = scores;
            _user = user;
            _score = score;
            InitializeComponent();
        }

        public HighScores(long[] scores)
        {
            scoreList = scores;
            InitializeComponent();
        }
        
        private void HighScores_Load(object sender, EventArgs e)
        {
            if (_user == null) tbUserName.Visible = false;
            else tbUserName.Text = _user;

            if (_score > 0)
                lblScore.Text = string.Format(lblScore.Text, _score);
            else
                lblScore.Visible = false;

            List<long> list = new List<long>(scoreList);
            list.Sort();
            list.Reverse();
            List<string> list2 = list.ConvertAll<string>(delegate(long l) { return l.ToString(); });
            scores.Text = string.Join("\n", list2.ToArray());
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }
    }
    public class Score
    {
        string player;
        int score;
    };
}
